package com.eco.fanliapp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.dao.SyUserIntegralRecordMapper;
import com.eco.fanliapp.entity.SyUserIntegralRecord;
import com.eco.fanliapp.service.ISyUserIntegralRecordService;
import com.eco.fanliapp.utils.MapValueHelper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-12-24
 */
@Service
public class SyUserIntegralRecordServiceImpl extends ServiceImpl<SyUserIntegralRecordMapper, SyUserIntegralRecord> implements ISyUserIntegralRecordService {

    @Autowired
    private SyUserIntegralRecordMapper syUserIntegralRecordMapper;

    @Override
    public ServerResponse userIntegralRecordList(HashMap<String, Object> params) {
        MapValueHelper mapValueHelper = new MapValueHelper(params);
        int currentPage = mapValueHelper.getInt("currentPage");
        int pageSize = mapValueHelper.getInt("pageSize");
        PageHelper.startPage(currentPage,pageSize);
        List<SyUserIntegralRecord> syUserIntegralRecords = syUserIntegralRecordMapper.userIntegralRecordList(params);
        return ServerResponse.createBySuccess("查询成功",new PageInfo(syUserIntegralRecords));
    }
}
